//
//  UserAgreementWebController.m
//  CheekiOS
//
//  Created by mac on 2017/7/2.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UserAgreementWebController.h"

@interface UserAgreementWebController ()


@end

@implementation UserAgreementWebController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self selfTitleFontColor];
    [self setNavgationBarHidden];
    
    
    
    
    
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 64)];
    bgView.backgroundColor = Colorbackground;
    [self.view addSubview:bgView];
    
    
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(22, 19.5, 44, 44)];
    btn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft ;//设置文字位置，现设为居左，默认的是居中
    
    [btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    btn.imageEdgeInsets = UIEdgeInsetsMake(0, 5.5, 0, 0);
    [btn addTarget:self action:@selector(backActionbtn) forControlEvents:UIControlEventTouchUpInside];
    CGFloat TopsegmentFloat ;
    
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
        NSLog(@"ipad");
        TopsegmentFloat =0;
        
    }else{
        TopsegmentFloat = 16;
        
        NSLog(@"iphone or ipod");
    }
    
    UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, TopsegmentFloat, KScreenWidth, 44*SCREEN_WIDTH_RATIO47)];
    titleLab.text = _setTitle;
    titleLab.font = [UIFont systemFontOfSize:18];
    titleLab.textColor = ColorI(0x2e353f);
    titleLab.textAlignment = NSTextAlignmentCenter;
    [bgView addSubview:titleLab];
    [bgView addSubview:btn];

    
    UIWebView* webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, btn.bottom, KScreenWidth, KScreenHeight-64)];
    
    webView.scalesPageToFit = YES;//自动对页面进行缩放以适应屏幕

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.UrlStr]];
    
    [webView loadRequest:request];
    
    [self.view addSubview:webView];

}

- (void)backActionbtn{

    [self.navigationController popViewControllerAnimated:YES];

}
@end
